#include <list>
#include <sstream>
#include "book.h"
#include "student.h"
#include "teacher.h"
#include "studyOfOtherUni.h"
#include "other.h"
#include "rental.h"
#ifndef LIBRARY_H
#define LIBRARY_H

class Library{
    public:
        enum Exceptions {M_FILEDONOTEXIST, B_FILEDONOTEXIST, R_FILEDONOTEXIST,
                         B_DATA_REDUNDANCY, B_DATA_DOESNOTEXIST, ISNOTRENT,
                         M_DATA_REDUNDANCY, M_DATA_DOESNOTEXIST, OWE,
                         R_DATA_DOESNOTEXIST};

        // BOOK METHODS
        void addBook(const Book &b) throw(Exceptions);
        void delBook(const std::string& id) throw(Exceptions);
        void fillBooksFromFile(const std::string &fname) throw(Exceptions);
        void listBooks() const;
        void saveDataOfBooks(const std::string &fname) const;
        void searchBook(const std::string& type, const std::string& key) const;

        // MEMBER METHODS
        void addMember(const std::string &typ, std::stringstream &m) throw(Exceptions);
        void delMember(const std::string& id) throw(Exceptions);
        void fillMembersFromFile(const std::string &fname) throw(Exceptions);
        void listMembers() const;
        void payment(const std::string &id, const int &val) throw(Exceptions);
        void saveDataOfMembers(const std::string &fname) const;
        void searchMember(const std::string& type, const std::string& key) const;

        // RENTAL METHODS
        void addRentalOut(const Rental&) throw(Exceptions);
        void addRentalIn(const Rental&) throw(Exceptions);
        void fillRentalsFromFile(const std::string &fname) throw(Exceptions);
        void saveDataOfRentals(const std::string &fname) const;
        void searchRental(const std::string&) const throw(Exceptions);

    private:
        std::list<Book> books;

        std::list<Student> members01;
        std::list<Teacher> members02;
        std::list<StudyOfOtherUni> members03;
        std::list<Other> members04;

        std::list<Rental> rentals;

};

#endif // LIBRARY_H
